import PLATFORM from '@/utils/platform'

const isWeixin = PLATFORM.isMpWeixin
export function getSafeInfo() {
  if (isWeixin) {
    const systemInfo = uni.getWindowInfo()
    const safeAreaInsets = systemInfo.safeAreaInsets || {
      top: 0,
      right: 0,
      bottom: 0,
      left: 0,
    }
    return {
      ...safeAreaInsets,
      windowHeight: systemInfo.windowHeight,
    }
  } else {
    const systemInfo = uni.getSystemInfoSync()
    return {
      ...systemInfo.safeAreaInsets,
      windowHeight: systemInfo.windowHeight,
    }
  }
}

